package com.diana.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.diana.entity.ManagerRoleMenu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author anzhi
 * @since 2019-04-21
 */
public interface ManagerRoleMenuMapper extends BaseMapper<ManagerRoleMenu> {

    /**
     * 查询用户是的有权限
     * @param managerId
     * @param menuId
     * @return
     */
    @Select("select count(1) from manager_main a left join manager_role b on a.roleId=b.roleId left join " +
            "manager_role_menu c on b.roleId = c.roleId where a.managerId = #{managerId} and c.menuId = #{menuId} ")
    int isHavePermission(@Param("managerId") String managerId, @Param("menuId") String menuId);
}
